app.controller('BusVehicleShiftModalCtrl', function ($scope, $modalInstance, param,ajax) {

	$scope.param = param;
	if ($scope.param.data == null) {
		$scope.param.data = {};
	}
	
	$scope.vehiclelist=[];
	
    (function(){
        var promise = ajax.call(new Req.GET({
            resource: 'vehicle/bs/ok'
        }));
        promise.then(function (result) {
            $scope.vehiclelist = result.result;
        }, function () { });
    })();
    
	$scope.ok = function () {
		if ($scope.myForm.$valid){
            if($scope.vehiclelist.selected == undefined){
                toaster.pop('warning', '提示', '请选择车辆！');
                return;             	   
           }			
			$scope.param.data=$scope.vehiclelist.selected;
			$modalInstance.close($scope.param);	
		} 
	};

	$scope.cancel = function () {
		$modalInstance.dismiss('cancel');
	};
});